<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<form method="post" action="" name="myform">
    <h1>我几岁了？</h1>
    <input id="myIuput" type="text" value="Hello World!" size="50"/>
    <input id="otherInput" type="text" size="50"/>
</form>
<script type="text/javascript">
    (function(){
        window._$=window.$;
        var Shake = window.Shake = window.$ = function(selector) {
            return new Shake.fn.init(selector);
        };
        Shake.fn=Shake.prototype={
            init: function(selector) { if(selector) this.selector = selector; return this; },
            val:function(newValue){
                if(!(this.selector && this.selector.indexOf('#')==0 && this.selector.length!=1))
                    return;    //  return如果后面没有值 表示 js脚本停止运行
                var id=this.selector.substring(1),
                        obj=document.getElementById(id);
                if(obj){
                    if(newValue==undefined)
                        return obj.value;
                    obj.value=newValue;
                    return this;
                }
            }
        };
        Shake.fn.init.prototype=Shake.fn;
    })();
    (function($){
        $.noConflict=function(){
            window.$=window._$;
        };
    })(Shake);
    Shake.noConflict();
    alert('object old value is '+Shake('#myInput').val());
</script>
</body>
</html>